Kanzi  3.9.9
Kanzi Engine C++ API
kanzi::TextConceptImpl< TDerivedClass > Class Template Reference

TextConceptImpl provides the common base implementation for text rendering nodes. More...

#include <kanzi/ui/node/concept/text_concept.hpp>

Inheritance diagram for kanzi::TextConceptImpl< TDerivedClass >:
[legend]

Public Member Functions

ColorRGBA getFontColor () const
 Gets the value of the FontColorProperty. More...
 
MaterialSharedPtr getFontMaterial () const
 Gets the value of the FontMaterialProperty. More...
 
bool getHorizontalFit () const
 Gets the value of the HorizontalFitProperty. More...
 
Vector2 getHorizontalFitScaleLimits () const
 Gets the value of the HorizontalFitScaleLimitsProperty. More...
 
Vector2 getHorizontalPadding () const
 Gets the value of HorizontalPaddingProperty. More...
 
string getOverflow () const
 Gets the value of the OverflowProperty. More...
 
bool getRemoveSideBearings () const
 Gets the value of the RemoveSideBearingsProperty. More...
 
string getText () const
 Gets the value of TextProperty. More...
 
TextFormat::TextHorizontalAlignment getTextHorizontalAlignment () const
 Gets the value of the TextHorizontalAlignmentProperty. More...
 
TextFormat::TextVerticalAlignment getTextVerticalAlignment () const
 Gets the value of the TextVerticalAlignmentProperty. More...
 
TextFormat::Truncation getTruncation () const
 Gets the value of the TruncationProperty. More...
 
TextFormat::TruncationDirection getTruncationDirection () const
 Gets the value of the TruncationDirectionProperty. More...
 
Vector2 getVerticalPadding () const
 Gets the value of VerticalPaddingProperty. More...
 
void setFontColor (ColorRGBA value)
 Sets the value of the FontColorProperty. More...
 
void setFontMaterial (MaterialSharedPtr value)
 Sets the value of the FontMaterialProperty. More...
 
void setHorizontalFit (bool value)
 Sets the value of the HorizontalFitProperty. More...
 
void setHorizontalFitScaleLimits (Vector2 value)
 Sets the value of the HorizontalFitScaleLimitsProperty. More...
 
void setHorizontalPadding (Vector2 value)
 Sets the value of HorizontalPaddingProperty. More...
 
void setOverflow (string_view value)
 Sets the value of the OverflowProperty. More...
 
void setRemoveSideBearings (bool value)
 Sets the value of the RemoveSideBearingsProperty. More...
 
void setText (string value)
 Sets the value of TextProperty. More...
 
void setTextHorizontalAlignment (TextFormat::TextHorizontalAlignment value)
 Sets the value of the TextHorizontalAlignmentProperty. More...
 
void setTextVerticalAlignment (TextFormat::TextVerticalAlignment value)
 Sets the value of the TextVerticalAlignmentProperty. More...
 
void setTruncation (TextFormat::Truncation value)
 Sets the value of the TruncationProperty. More...
 
void setTruncationDirection (TextFormat::TruncationDirection value)
 Sets the value of the TruncationDirectionProperty. More...
 
void setVerticalPadding (Vector2 value)
 Sets the value of VerticalPaddingProperty. More...
 
virtual ~TextConceptImpl ()=default
 Destructor. More...
 
- Public Member Functions inherited from kanzi::TextConcept
virtual ~TextConcept ()=default
 Destructor. More...
 

Static Public Member Functions

static PropertyTypeEditorInfoSharedPtr makeEditorInfo ()
 
- Static Public Member Functions inherited from kanzi::TextConcept
static PropertyTypeEditorInfoSharedPtr makeEditorInfo ()
 

Protected Member Functions

void prepareTextFormat (const TextFormatParameters &parameters, string text)
 Updates the parameters and text of the internal text format. More...
 
 TextConceptImpl ()=default
 Constructor. More...
 

Protected Attributes

TextFormatPtr m_textFormat
 The text format for the text that this node displays. More...
 

Additional Inherited Members

- Static Public Attributes inherited from kanzi::TextConcept
static PropertyType< ColorRGBAFontColorProperty
 Sets the text color for the default font material and for the materials with a fragment shader that uses the FontColor uniform. More...
 
static PropertyType< ResourceSharedPtrFontMaterialProperty
 Sets the material whose shader is used to render the text in a 3D text node. More...
 
static PropertyType< string > TextProperty
 Sets the text content that a text node renders. More...
 
static PropertyType< TextFormat::TextHorizontalAlignmentTextHorizontalAlignmentProperty
 Sets the horizontal alignment of the text in a text node. More...
 
static PropertyType< TextFormat::TextVerticalAlignmentTextVerticalAlignmentProperty
 Sets the vertical alignment of the text in a text node. More...
 
static PropertyType< Vector2HorizontalPaddingProperty
 Sets the padding spaces between the content and the left and right boundaries of a text node. More...
 
static PropertyType< Vector2VerticalPaddingProperty
 Sets the padding spaces between the content and the top and bottom boundaries of a text node. More...
 
static PropertyType< string > OverflowProperty
 Sets the characters that represent the truncated text when the text string to be rendered is too long to fit in a text node. More...
 
static PropertyType< TextFormat::TruncationTruncationProperty
 Sets how to truncate the text when the text string to be rendered is too long to fit in a node. More...
 
static PropertyType< TextFormat::TruncationDirectionTruncationDirectionProperty
 Sets which part of the text to truncate when the text string to be rendered is too long to fit in a node. More...
 
static PropertyType< bool > RemoveSideBearingsProperty
 Sets the position of the leftmost characters of left-aligned text and rightmost characters of right-aligned text exactly within the boundary of the text node. More...
 
static PropertyType< bool > HorizontalFitProperty
 Allows a Text Block to scale glyphs horizontally when the text string is too long to fit in that Text Block. More...
 
static PropertyType< Vector2HorizontalFitScaleLimitsProperty
 Sets the scale range that the HorizontalFitProperty can use when it scales the text horizontally. More...
 

Detailed Description

template<typename TDerivedClass>
class kanzi::TextConceptImpl< TDerivedClass >

TextConceptImpl provides the common base implementation for text rendering nodes.

It encapsulates TextFormat, which is responsible for text layouting and rendering.

TextConceptImpl derives from TextConcept, which defines the data and property types used by the implementation. Do not use these classes directly. Instead use:

To implement your own text rendering node:

  1. Derive from TextConceptImpl and FontStyleConceptImpl.
  2. Implement the void notifyPostPrepareTextFormat(bool) method.

    Kanzi calls this method after the underlying TextFormat updates the layout of the text. The only boolean parameter of this function indicates whether the text was relayouted.

  3. To update the text layout, call prepareTextFormat().

    Kanzi updates the underlying TextFormat with the parameters that you pass to the function and the parameters taken from FontStyleConceptImpl.

  4. To render text use the TextConceptImpl::m_textFormat member.
Since
Kanzi 3.9.0

Constructor & Destructor Documentation

template<typename TDerivedClass>
virtual kanzi::TextConceptImpl< TDerivedClass >::~TextConceptImpl ( )
virtualdefault

Destructor.

template<typename TDerivedClass>
kanzi::TextConceptImpl< TDerivedClass >::TextConceptImpl ( )
explicitprotecteddefault

Constructor.

Member Function Documentation

template<typename TDerivedClass>
static PropertyTypeEditorInfoSharedPtr kanzi::TextConceptImpl< TDerivedClass >::makeEditorInfo ( )
static
template<typename TDerivedClass >
ColorRGBA kanzi::TextConceptImpl< TDerivedClass >::getFontColor ( ) const

Gets the value of the FontColorProperty.

Returns
The color value of the default font material, or the color value of materials with fragment shader that uses the FontColor uniform. Returns the value in range [0,1].
See also
setFontColor()
template<typename TDerivedClass >
void kanzi::TextConceptImpl< TDerivedClass >::setFontColor ( ColorRGBA  value)

Sets the value of the FontColorProperty.

Parameters
valueThe ColorRGBA color value of the font material with fragment shader that uses the FontColor uniform.
See also
getFontColor()
template<typename TDerivedClass >
MaterialSharedPtr kanzi::TextConceptImpl< TDerivedClass >::getFontMaterial ( ) const

Gets the value of the FontMaterialProperty.

Returns
The font material currently in use.
See also
setFontMaterial()
template<typename TDerivedClass >
void kanzi::TextConceptImpl< TDerivedClass >::setFontMaterial ( MaterialSharedPtr  value)

Sets the value of the FontMaterialProperty.

Parameters
valueThe font material.
See also
getFontMaterial()
template<typename TDerivedClass >
Vector2 kanzi::TextConceptImpl< TDerivedClass >::getHorizontalPadding ( ) const

Gets the value of HorizontalPaddingProperty.

Returns
The space on the left and the right sides of the content.
See also
setHorizontalPadding()
template<typename TDerivedClass >
void kanzi::TextConceptImpl< TDerivedClass >::setHorizontalPadding ( Vector2  value)

Sets the value of HorizontalPaddingProperty.

Parameters
valueThe space on the left and the right sides of the content.
See also
getHorizontalPadding()
template<typename TDerivedClass >
string kanzi::TextConceptImpl< TDerivedClass >::getText ( ) const

Gets the value of TextProperty.

See also
setText()
template<typename TDerivedClass >
void kanzi::TextConceptImpl< TDerivedClass >::setText ( string  value)

Sets the value of TextProperty.

See also
getText()
template<typename TDerivedClass >
TextFormat::TextHorizontalAlignment kanzi::TextConceptImpl< TDerivedClass >::getTextHorizontalAlignment ( ) const

Gets the value of the TextHorizontalAlignmentProperty.

Returns
The horizontal alignment of the object.
See also
setTextHorizontalAlignment()
template<typename TDerivedClass >
void kanzi::TextConceptImpl< TDerivedClass >::setTextHorizontalAlignment ( TextFormat::TextHorizontalAlignment  value)

Sets the value of the TextHorizontalAlignmentProperty.

Parameters
valueOne of the TextFormat::TextHorizontalAlignment enumerator values.
See also
getTextHorizontalAlignment()
template<typename TDerivedClass >
TextFormat::TextVerticalAlignment kanzi::TextConceptImpl< TDerivedClass >::getTextVerticalAlignment ( ) const

Gets the value of the TextVerticalAlignmentProperty.

Returns
The vertical alignment of the object.
See also
setTextVerticalAlignment()
template<typename TDerivedClass >
void kanzi::TextConceptImpl< TDerivedClass >::setTextVerticalAlignment ( TextFormat::TextVerticalAlignment  value)

Sets the value of the TextVerticalAlignmentProperty.

Parameters
valueOne of the TextFormat::TextVerticalAlignment enumerator values.
See also
getTextVerticalAlignment()
template<typename TDerivedClass >
Vector2 kanzi::TextConceptImpl< TDerivedClass >::getVerticalPadding ( ) const

Gets the value of VerticalPaddingProperty.

Returns
The space on the top and the bottom of the content.
See also
setVerticalPadding()
template<typename TDerivedClass >
void kanzi::TextConceptImpl< TDerivedClass >::setVerticalPadding ( Vector2  value)

Sets the value of VerticalPaddingProperty.

Parameters
valueThe space on the top and the bottom of the content.
See also
getVerticalPadding()
template<typename TDerivedClass >
string kanzi::TextConceptImpl< TDerivedClass >::getOverflow ( ) const

Gets the value of the OverflowProperty.

Returns
The characters that represent the truncated text when the text string is too long to fit in the node.
See also
setOverflow()
template<typename TDerivedClass >
void kanzi::TextConceptImpl< TDerivedClass >::setOverflow ( string_view  value)

Sets the value of the OverflowProperty.

Parameters
valueThe characters that represent the truncated text when the text string is too long to fit in the node.
See also
getOverflow()
template<typename TDerivedClass >
bool kanzi::TextConceptImpl< TDerivedClass >::getHorizontalFit ( ) const

Gets the value of the HorizontalFitProperty.

Returns
If the Text Block allows horizontal scaling of glyphs, true, otherwise false.
template<typename TDerivedClass >
void kanzi::TextConceptImpl< TDerivedClass >::setHorizontalFit ( bool  value)

Sets the value of the HorizontalFitProperty.

Parameters
valueWhether to enable the horizontal scaling of glyphs when the text string is too long to fit in that Text Block.
template<typename TDerivedClass >
Vector2 kanzi::TextConceptImpl< TDerivedClass >::getHorizontalFitScaleLimits ( ) const

Gets the value of the HorizontalFitScaleLimitsProperty.

Returns
The minimum and maximum amount to which the HorizontalFitProperty can scale the glyphs in a Text Block node.
template<typename TDerivedClass >
void kanzi::TextConceptImpl< TDerivedClass >::setHorizontalFitScaleLimits ( Vector2  value)

Sets the value of the HorizontalFitScaleLimitsProperty.

Parameters
valueWhen the HorizontalFitProperty is enabled, sets the minimum and maximum scale for glyphs when the width of text in a Text Block does not match the Layout Width property of that Text Block. For example:
  • Min property field set to 1.0 does not squeeze the glyphs, while 0.5 allows squeezing the glyphs to half their size.
  • Max property field set to 1.0 does not stretch the glyphs, while 2.0 allows stretching the glyphs to double their size.
template<typename TDerivedClass >
bool kanzi::TextConceptImpl< TDerivedClass >::getRemoveSideBearings ( ) const

Gets the value of the RemoveSideBearingsProperty.

Returns
If the position of the leftmost characters of left-aligned text and rightmost characters of right-aligned text are to be exactly within the boundary of the text node, true, otherwise false.
template<typename TDerivedClass >
void kanzi::TextConceptImpl< TDerivedClass >::setRemoveSideBearings ( bool  value)

Sets the value of the RemoveSideBearingsProperty.

Parameters
valueThe value that determines if the position of the leftmost characters of left-aligned text and rightmost characters of right-aligned text are to be exactly within the boundary of the text node or not.
template<typename TDerivedClass >
void kanzi::TextConceptImpl< TDerivedClass >::setTruncationDirection ( TextFormat::TruncationDirection  value)

Sets the value of the TruncationDirectionProperty.

Parameters
valueThe truncation direction for the text that does not fit in the node.
Since
Kanzi 3.9.6
template<typename TDerivedClass >
TextFormat::TruncationDirection kanzi::TextConceptImpl< TDerivedClass >::getTruncationDirection ( ) const

Gets the value of the TruncationDirectionProperty.

Returns
The truncation direction for the text that does not fit in the node.
Since
Kanzi 3.9.6
template<typename TDerivedClass >
void kanzi::TextConceptImpl< TDerivedClass >::setTruncation ( TextFormat::Truncation  value)

Sets the value of the TruncationProperty.

Parameters
valueTruncation policy for the text that does not fit in the node.
Since
Kanzi 3.9.6
template<typename TDerivedClass >
TextFormat::Truncation kanzi::TextConceptImpl< TDerivedClass >::getTruncation ( ) const

Gets the value of the TruncationProperty.

Returns
Truncation policy for the text that does not fit in the node.
Since
Kanzi 3.9.6
template<typename TDerivedClass >
void kanzi::TextConceptImpl< TDerivedClass >::prepareTextFormat ( const TextFormatParameters parameters,
string  text 
)
protected

Updates the parameters and text of the internal text format.

Calls notifyPostPrepareTextFormat() when the text format is created or reused successfully.

Parameters
parametersCollection of parameters that are used to configure the text format.
textThe text that is layouted using the text format.

Member Data Documentation

template<typename TDerivedClass>
TextFormatPtr kanzi::TextConceptImpl< TDerivedClass >::m_textFormat
protected

The text format for the text that this node displays.


The documentation for this class was generated from the following files: